package de.tum.in.eist.im.client.GUIwidgets;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;

import de.tum.in.eist.im.client.GUI;

public class GroupInvite extends UserPrompt {
	String groupName;
	public GroupInvite(String groupName, GUI returnTo) {
		super("You were invited to join " + groupName + "", returnTo
				.getParentIM());
		this.groupName = groupName;
		
		OKButton.setText("ACCEPT");
		cancelButton.setText("DECLINE");

		addHandlerToWidgets();
	}

	@Override
	public void addHandlerToWidgets() {
		OKButton.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				returnTo.acceptInvite(groupName);
				inviteDialog.hide();
			}
		});

		cancelButton.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				inviteDialog.hide();
			}
		});
	}
}
